package com.easypreview.preview.domain.channel;

import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
/**
 * 栏目
 * @author ajian
 *
 */
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable="true")
public class Channel implements Comparable<Channel> {
	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;
	
	@Persistent
	private String id;
	
	@Persistent
	private String fatherId;
	
	@Persistent
	private String name;
	
	@Persistent
	private String path;
	
	@Persistent
	private int sort;
	
	@Persistent
	private String title;	
	
	@Persistent
	private String tags;
	
	@Persistent
	private String hotKeyWord;
	
	@Persistent
	private String metaKeyWord;
	
	@Persistent
	private String metaTitle;
	
	@Persistent
	private String metaDescr;
	
	@Persistent
	private String anchorText;
	
	@Persistent
	private String attributes;
	
	@Persistent
    private Date date;
	
//	@NotPersistent
//	private Channel father;
//	
//	@NotPersistent
//	private List<Channel> children = new ArrayList<Channel> ();
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	public String getAnchorText() {
		return anchorText;
	}

	public void setAnchorText(String anchorText) {
		this.anchorText = anchorText;
	}
	
	public String getMetaTitle()
	{
		return metaTitle;
	}

	public void setMetaTitle(String metaTitle)
	{
		this.metaTitle = metaTitle;
	}

	public String getHotKeyWord() {
		return hotKeyWord;
	}

	public void setHotKeyWord(String hotKeyWord) {
		this.hotKeyWord = hotKeyWord;
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public int getSort() {
		return sort;
	}

	public void setSort(int sort) {
		this.sort = sort;
	}

	
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getMetaKeyWord() {
		return metaKeyWord;
	}

	public void setMetaKeyWord(String metaKeyword) {
		this.metaKeyWord = metaKeyword;
	}

	public String getMetaDescr() {
		return metaDescr;
	}

	public void setMetaDescr(String metaDescr) {
		this.metaDescr = metaDescr;
	}

	public String getTags() {
		return tags;
	}

	public void setTags(String tags) {
		this.tags = tags;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Comparable#compareTo(java.lang.Object)
	 */
	@Override
	public int compareTo(Channel other) {
		return this.getSort() - other.getSort();
	}

	public String getAttributes() {
		return attributes;
	}

	public void setAttributes(String attributes) {
		this.attributes = attributes;
	}
	
	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public Key getKey() {
		return key;
	}

	public void setKey(Key key) {
		this.key = key;
	}

	public String getFatherId() {
		return fatherId;
	}

	public void setFatherId(String fatherId) {
		this.fatherId = fatherId;
	}

//	public Channel getFather() {
//		return father;
//	}
//
//	public void setFather(Channel father) {
//		this.father = father;
//	}
//
//	public List<Channel> getChildren() {
//		return children;
//	}
//
//	public void setChildren(List<Channel> children) {
//		this.children = children;
//	}

}
